package cn.net.sinodata.threadpool.base;

import java.util.HashMap;
import java.util.Map;

/**
 * Description: 线程状态枚举
 *
 * @author: yinliangyun
 * @date: 2021-5-19
 */
public enum ThreadStatusEnum {

	NEW(0, "创建"), RUNNABLE(1, "运行"), BLOCKED(2, "阻塞"), WAITING(3, "等待"), TIMED_WAITING(4, "睡眠"), TERMINATED(5, "终止");

	private int value;

	private String name;

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private ThreadStatusEnum(int value, String name) {
		this.value = value;
		this.name = name;
	}

	public static Map<Integer, ThreadStatusEnum> getThreadStatusEnumMap() {
		ThreadStatusEnum[] threadStatusEnums = ThreadStatusEnum.values();
		Map<Integer, ThreadStatusEnum> threadStatusEnumMap = new HashMap<Integer, ThreadStatusEnum>();
		for (ThreadStatusEnum threadStatusEnum : threadStatusEnums) {
			threadStatusEnumMap.put(threadStatusEnum.getValue(), threadStatusEnum);
		}
		return threadStatusEnumMap;
	}

}
